<template>
  <el-row>
    <el-col :span="24">
      <el-card>
        <el-form ref="searchForm" class="el-form-col search-form" :model="search">
          <el-row :gutter="15">
            <el-col :lg="4" :md="6">
              <el-form-item prop="cargoOwnerCode">
                <el-input v-model="search.cargoOwnerCode" placeholder="商家编号" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item prop="cargoOwnerName">
                <el-input v-model="search.cargoOwnerName" placeholder="商家名称" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item prop="cargoOwnerPrin">
                <el-input v-model="search.cargoOwnerPrin" placeholder="商家联系人" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item  prop="cargoOwnerPhone">
                <el-input v-model="search.cargoOwnerPhone" placeholder="联系电话"></el-input>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item>
                <el-row class="search-btns" :gutter="5">
                  <el-col :span="12">
                    <el-button type="primary" :loading="searchLoading" plain native-type="submit" @click.prevent="searchFunc(search)"><span>搜索</span></el-button>
                  </el-col>
                  <el-col :span="12">
                    <el-button @click="resetFields" plain>重置</el-button>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

        </el-form>
      </el-card>
    </el-col>
    <el-col :span="24">
      <BasicTable
        ref="BasicTable"
        url="/ms-warehouse-order/fastforward/findFastForwardList"
        :tabs="tabs"
        :columns="columns">
        <template slot="preColumn">
          <el-table-column prop="orderNo" fixed="left" width="170px" align="center" label="商家编号">
            <template slot-scope="scope">
              <!--<a href="javascript:;" class="blue-color" @click="show(scope.row)">{{ scope.row.cargoOwnerCode }}</a>-->
              <a href="javascript:;" class="blue-color" @click="show(scope.row)">{{ scope.row.cargoOwnerCode }}</a>
            </template>
          </el-table-column>
        </template>
        <template slot="column">
          <el-table-column fixed="right" width="100px" align="center" label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                @click="show(scope.row)"
              >
                查看
              </el-button>
            </template>
          </el-table-column>
        </template>
      </BasicTable>
    </el-col>
  </el-row>
</template>
<script>
import {copy} from '@/utils'
// import {copy, dotData, confirm} from '@/utils'
export default {
  name: 'tempStoreIndex',
  data() {
    return {
      isOpen: false,
      visible: false,
      searchLoading: false,
      search: {
        cargoOwnerCode: '',
        cargoOwnerName: '',
        cargoOwnerPrin: '',
        cargoOwnerPhone: ''
      },
      tabs: [],
      columns: [
        {
          label: '商家名称',
          data: 'cargoOwnerName'
        },
        {
          label: '商家联系人',
          data: 'cargoOwnerPrin'
        },
        {
          label: '联系电话',
          data: 'cargoOwnerPhone'
        },
        {label: '在库订单', data: 'totalOrder'},
        {label: '总包件', data: 'totalPackage'},
        {label: '总体积', data: 'totalVolume'},
        {label: '总重量', data: 'totalWeight'}
        // {
        //   label: '包件库存位置',
        //   data: 'location'
        // },
        // {
        //   label: '在库包件数量',
        //   data: 'availablePackageNum'
        // },
        // {
        //   label: '总体积(m³)',
        //   data: 'libraryPackageVolume'
        // }
      ]
    }
  },
  created() {
  },
  methods: {
    // 搜索
    searchFunc(search) {
      const basicTable = this.$refs.BasicTable
      if (basicTable) {
        let params = copy(search)
        this.searchLoading = true
        basicTable.search(params).finally(_ => {
          this.searchLoading = false
        })
      }
    },
    // 重置表单
    resetFields() {
      const searchForm = this.$refs.searchForm
      if (searchForm) {
        searchForm.resetFields()
      }
    },
    // 表格刷新
    refresh() {
      this.searchFunc(this.search)
    },
    // 跳转详情
    show(data) {
      this.$router.push({path: '/ss-oms/warehouse/temp-store/show/' + data.cargoOwnerId})
    }
  }
}
</script>
